import { Component, OnInit } from '@angular/core';
import { Response } from '@angular/http';

import {HotSearchService} from "./hotSearch.service";

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.less'],
  providers: [ HotSearchService ]
})
export class HeaderComponent implements OnInit {
  hotSearch;
  constructor(private hotSearchService: HotSearchService) { }

  ngOnInit() {
    this.hotSearchService.getHotSearch()
      .subscribe(
        (response: Response) => {
          const data = response.json();
          this.hotSearch = data.data.right.search.hotSearch;
          // console.log('a',data.data.right.search.hotSearch);
        },
        (errors) => {
          console.log(errors);
        }
      );
  }

}
